#include <iostream>
#include <string>

using namespace std;

int n, root;
int lh[30], rh[30];
string s;

void preorder(int root) {
	
	if (root != '*' - 'a') {
		cout << (char)(root + 'a');
		preorder(lh[root]);
		preorder(rh[root]);
	}

}

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s;
		if (!i) {
			root = s[0] - 'a';
		}

		lh[s[0] - 'a'] = s[1] - 'a';
		rh[s[0] - 'a'] = s[2] - 'a';
	}

	preorder(root);

	return 0;
}
